home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / grsear20.zip / GRINIT.DOC < prev    next >
Text File  |  1993-01-04  |  4KB  |  79 lines

  1. Author: 7/17/88    Michael Shunfenthal  Compuserve ID [76320,122]
  2.  
  3. FILES          Explanation
  4. GRINITDR.PAS   Driver program showing how to use the unit.
  5. GRINITUN.PAS   The source code for the graphics search function
  6. GRINIT.DOC     This file
  7.  
  8. WHAT IT DOES
  9. Determine the graphics adapter type, search for the driver file, and
  10. start graphics mode.
  11.  
  12. This boolean function replaces the procedure InitGraph by allowing you to
  13. specify a list of directories in an environment variable (default: the
  14. PATH variable) delimited by semicolons, where the appropriate graphics
  15. driver may be located.  This program searches the default subdirectory,
  16. then each of the directories in the path until the driver file is located.
  17. The function returns true if the driver file is found, false otherwise.
  18.  
  19. DECLARATION AND USAGE
  20. function grsearch (environvar : string; var GraphDriver : integer;
  21.           var dirstring : string; grdebug : debugrange) : boolean;
  22. {    Explanation:
  23.     function true: driver found and adapter initialized
  24.              false: an error prevents graphics initialization
  25.     environvar:  contains the desired environment variable name to be
  26.                  examined for the list of directories in the format of the
  27.                  path variable.  if null, ('') PATH is the default.
  28.     GraphDriver: graphics driver found by DetectGraph
  29.     dirstring:   contains the path to the required driver file
  30.     grdebug: 0 = no display.  use the only function value to indicate status
  31.              1 = display errors only
  32.              2 = informational (the directories in the variable
  33.                    will be listed) and errors displayed
  34.  }
  35.  
  36. PROGRAM CONSTANTS AND ASSUMPTIONS
  37. 1. Environment space: MaxEnvironSpace bytes max
  38. 2. Environment variable length: MaxVarLength bytes max.
  39. 3. The equals sign '=' is assumed to immediately follow the name.
  40. 4. Maximum number of directories in the variable: MaxDirectories
  41. 5. Maximum length of each directory string: MaxDirLength
  42.  
  43. COMPILING AND USING the GRINITUN unit with the example driver GRINITDR: 
  44. (Substitute your program in place of GRINITDR.)
  45. 1. load the driver into the turbo editor
  46. 2. In the Compile pulldown menu, select Destination: Disk
  47. 3. Select Make.  This will compile the driver.  If this unit
  48.    has not been already compiled, it will be done automatically
  49.    into the output file GRINITUN.TPU, and the executable file
  50.    GRINITDR.EXE will be created.
  51.  
  52. GRINITUN works as follows -
  53. 1. determine the graphics display type.
  54. 2. Search the environment for the desired variable (or PATH if null).
  55. 3. Locate the appropriate driver be searching first the default
  56.    directory, then the directories listed in the environment variable.
  57. 4. Initialize the adaptor to graphics mode.
  58.  
  59. Environment:   0=null ASCII byte
  60. *******************************************************
  61. AXXX=---------------------0
  62. CYYYYY=-----------------------------0
  63. DZZ=--------------------------0
  64. PATH=-----------------------------------0
  65. FGGGGG=---------------------------00
  66. *******************************************************
  67. Locatevariable returns the starting of the desired variable
  68. Readenvironment calls locatevariable at the beginning of each var start
  69. and exits after 2 nulls.
  70.  
  71. Changes from V1.0 of GRSEARCH.PAS:
  72. 1. put into a unit and converted to a function with passed parameters.
  73. 2. bug fixed: dirlist array not fully initialized
  74. 3. added: constants for important parameters
  75. 4. more variables passed as parameters rather than made global
  76. 5. conditional printing of internal functions activated by the
  77.    grdebug parameter.
  78.  
  79.